from .config import Config

class Weapon:
    def __init__(self, name='none', mirror='', k=1.0):
        self.name = name
        self.maxBullets = 0
        self.model = 'auto'
        self.speed = 0
        self.basic = []
        self.mirror_k = 1.0  # 倍镜系数
        self.k = k  # 微调系数
        self.hold = 1.33

        if name != "none" and name != '':
            try:
                gun_data = Config.guns[name]
                self.maxBullets = gun_data['maxBullets']
                self.model = gun_data['model']
                self.speed = gun_data['speed']
                self.basic = gun_data['basic']
                self.hold = gun_data['hold']
                
                # 保存倍镜系数
                if mirror != 'none' and mirror != '':
                    self.mirror_k = gun_data['mirror'][mirror]
            except Exception as e:
                print(type(e), '::', e) 